<!--
  @Descripttion:：运营端-应聘反馈
  @Author：yejianbo
  @Date：2022年10月19日
-->
<template>
  <section>
    <div
      v-if="
        Number(item.status) === 6 ||
          Number(item.status) === 7 ||
          Number(item.status) === 8
      "
    >
      <div v-if="item.evaluation" class="step-item">
        <!-- todo 创建时间 -->
        <el-card class="box-card">
          <div class="h1">企业反馈</div>
          <div class="title">面试结果：</div>
          <div class="content">
            {{ getInviteStatus(item.inviteResult) }}
          </div>
          <div class="title">评价/原因：</div>
          <div class="content">{{ item.evaluation }}</div>
          <div class="tips">
            <!-- todo 创建时间 -->
            {{ item.publisherName }}提交于{{ moment(item.evaluationTime).format('yyyy-MM-DD HH:mm:ss') }}
          </div>
        </el-card>
      </div>
      <div v-if="item.feedback" class="step-item">
        <!-- todo 创建时间 -->
        <el-card class="box-card">
          <div class="h1">学生反馈</div>
          <div class="title">面试结果：</div>
          <div class="content">
            {{ getInviteStatus(JSON.parse(item.inviteResultType)) }}
          </div>
          <div class="title">评价/原因：</div>
          <div class="content">{{ item.feedback }}</div>
          <div class="tips">
            <!-- todo 创建时间 -->
            {{ item.studentName }}提交于{{ moment(item.feedbackTime).format('yyyy-MM-DD HH:mm:ss') }}
          </div>
        </el-card>
      </div>
    </div>
    <el-empty v-else description="暂无数据" />
  </section>
</template>

<script>
import moment from 'moment'
import { resumeStatus, getInviteStatus } from '@/utils/frontDataDict.js'
export default {
  // 组件名称
  name: 'InviteRecord',
  // 组件状态值
  data() {
    return {
      getInviteStatus: getInviteStatus,
      moment: moment,
      // 投递记录的简历状态 0 未查看简历、1 已查看简历、2 已发送面试邀约、3 已确认面试邀约、4 已拒绝面试邀约、5 已面试反馈（企业）、6 已评价（学生）
      resumeStatus: resumeStatus,
      stepNum: 1,
      item: {
        studentName: '',
        phoneNumber: '',
        email: '',
        inviteDate: '',
        companyId: 0,
        companyName: '',
        publisherName: '',
        status: '',
        inviteContent: '',
        jobName: '',
        inviteWay: '',
        inviteAddress: '',
        inviteCoordinate: '',
        noticeItem: '',
        inviteResult: '',
        evaluation: '',
        feedback: '',
        id: 0,
        sendRecordId: 0,
        createTime: '',
        updateTime: ''
      }
    }
  },
  // 组件方法
  methods: {
    open(item) {
      Object.assign(this.item, item)
    },
    returnStatuText(code) {
      if (!code) return '--'
      const hasitem = this.resumeStatus.find((item) => {
        return Number(item.value) === Number(code)
      })
      return hasitem ? hasitem.label : '--'
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.step-item {
  position: relative;
  width: 100%;
  padding-left: 40px;
  padding-bottom: 30px;
  .date {
    font-size: 16px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #9597a0;
    line-height: 20px;
    margin-bottom: 5px;
  }
  .h1 {
    font-size: 26px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #37383d;
    line-height: 34px;
    color: #2f8efe;
  }
  .title {
    font-size: 24px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #37383d;
    line-height: 30px;
    padding-left: 20px;
  }
  .content {
    font-size: 18px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #9597a0;
    line-height: 30px;
    padding-left: 20px;
  }
  .tips {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #b1b1b1;
    line-height: 37px;
    padding-left: 20px;
  }
  .red {
    color: #fe4e3d;
  }
}
</style>
